function ForUpload2(obj,imgType,func,checkFunc){
    var imgId = $(obj).attr('id');
    var _name = "ForUploadCallBack"+ imgId ;
    var _layerLoadIndex = 0;
    var _func = function(status,data,info){
        $('#ForUpload_'+imgId).find('input[type=file]').val('');
        layer.close(_layerLoadIndex);
        func(status,data,info);
    };
    eval('$.'+_name+' = _func;');
    var url = "/index.php?m=Master&c=Index&a=upload&subfun=$."+_name+"&type="+imgType;
    var pos = $(obj).offset();
    $('body').append('<div id="ForUpload_'+imgId+'" style="position:absolute;overflow:hidden;opacity: 0;display:none;"> '
    	+'<form action="'+url+'" target="exec_target" method="post" enctype="multipart/form-data"> '+
    	'<input  name="file" type="file" class="flexed1" style="margin:0px;padding:0px;cursor:pointer;" > </form>'
    	+'<iframe id="exec_target" name="exec_target" style="width:1px; height:1px"></iframe></div>');
    $('#ForUpload_'+imgId).find('input[type=file]').change(function(){
         if($(this).val() != ""){
             if(typeof(checkFunc) != 'undefined'){
                 var _data = checkFunc();
                 if( _data == false){
                     $(this).val('');
                     return;
                 }
                 url += '&extdata='+  escape(JSON.stringify(_data));
                 $('#ForUpload_'+imgId).find('form').attr('action',url);
             }
             _layerLoadIndex = layer.load(0,{ time: 15000 });
             $('#ForUpload_'+imgId).find('form')[0].submit();
             return;
         }
    }).height($(obj).outerHeight(true)).width($(obj).outerWidth(true));
    $('#ForUpload_'+imgId).css({ 'left':pos.left+'px','top':pos.top+'px' });
    $('#ForUpload_'+imgId).width($(obj).outerWidth(true));
    $('#ForUpload_'+imgId).height($(obj).outerHeight(true));
    $(window).resize(function() {
        var pos = $(obj).position();
        $('#ForUpload_'+imgId).css({ 'left':pos.left+'px','top':pos.top+'px' });
    });
    $(obj).mouseover(function() {
        var pos = $(obj).position();
        $('#ForUpload_'+imgId).css({ 'left':pos.left+'px','top':pos.top+'px' });
    });
    $('#ForUpload_'+imgId).find('input[type=file]').closest('input[type=file]').trigger('click');
}

function in_array(stringToSearch, arrayToSearch) {
    for (s = 0; s < arrayToSearch.length; s++) {
        thisEntry = arrayToSearch[s].toString();
        if (thisEntry == stringToSearch) {
            return true;
        }
    }
    return false;
}

function closeDiv()
{
    $('.saveTcBg').hide();
}